﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace PitOfDespair.Controllers
{
	using PitOfDespair.Models;
	using PitOfDespair.Models.Character;

	public partial class CombatController : Controller
	{
		//
		// GET: /Combat/

		public virtual ActionResult Index(CharacterModel pc, BaseCharacter npc, int seed = 0)
		{
			if (pc == null && Request.Params["pc"] != null) pc = Newtonsoft.Json.JsonConvert.DeserializeObject<CharacterModel>(Request.Params["pc"]);
			if (npc == null && Request.Params["npc"] != null) npc = Newtonsoft.Json.JsonConvert.DeserializeObject<BaseCharacter>(Request.Params["npc"]);
			var cm = new CombatModel(pc, npc, seed);
			cm.ResolveRound();
			return View(cm);
		}


	}
}
